<?php

/**
 * Generated Model class.
 */
class Base_ActivityPeer extends Db_Peer implements ISingleton
{

    const ID = '`activity`.`id`';

    const USER_ID = '`activity`.`user_id`';

    const TEXT = '`activity`.`text`';

    const CREATED_AT = '`activity`.`created_at`';

    protected $_name = 'activity';

    protected $_rowClass = 'ActivityRow';

    protected $_dependentTables = array();

    protected $_referenceMap = array();

    private static $_instance = null;

    protected $_metadata = array(
        'id' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'activity',
            'COLUMN_NAME' => 'id',
            'COLUMN_POSITION' => 1,
            'DATA_TYPE' => 'int',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => true,
            'PRIMARY_POSITION' => 1,
            'IDENTITY' => true
            ),
        'user_id' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'activity',
            'COLUMN_NAME' => 'user_id',
            'COLUMN_POSITION' => 2,
            'DATA_TYPE' => 'int',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'text' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'activity',
            'COLUMN_NAME' => 'text',
            'COLUMN_POSITION' => 3,
            'DATA_TYPE' => 'text',
            'DEFAULT' => null,
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            ),
        'created_at' => array(
            'SCHEMA_NAME' => null,
            'TABLE_NAME' => 'activity',
            'COLUMN_NAME' => 'created_at',
            'COLUMN_POSITION' => 4,
            'DATA_TYPE' => 'timestamp',
            'DEFAULT' => 'CURRENT_TIMESTAMP',
            'NULLABLE' => false,
            'LENGTH' => null,
            'SCALE' => null,
            'PRECISION' => null,
            'UNSIGNED' => null,
            'PRIMARY' => false,
            'PRIMARY_POSITION' => null,
            'IDENTITY' => false
            )
        );

    /**
     * @return ActivityPeer
     */
    public static function getInstance()
    {
        if (!self::$_instance) {
        	self::$_instance = new ActivityPeer();
        }
        return self::$_instance;
    }

    /**
     * @return Db_Rowset
     */
    public function findById($id)
    {
        $select = $this->select();
        $select->where('`id` = ?', $id);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByUserId($user_id)
    {
        $select = $this->select();
        $select->where('`user_id` = ?', $user_id);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByText($text)
    {
        $select = $this->select();
        $select->where('`text` = ?', $text);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }

    /**
     * @return Db_Rowset
     */
    public function findByCreatedAt($created_at)
    {
        $select = $this->select();
        $select->where('`created_at` = ?', $created_at);
        $rowset = $this->fetchAll($select);
        return $rowset;
    }


}

